<?php 
	function date_modif($dated){
		$hour = substr($dated,11,2);
		$minute = substr($dated,14,2);
		$second = substr($dated,17,2);
		$month = substr($dated,5,2);
		$day = substr($dated,8,2);
		$year = substr($dated,0,4);
		$formatted = array('hour'=>$hour,'minute'=>$minute,'second'=>$second,'month'=>$month,'day'=>$day,'year'=>$year);
		return $formatted;
	}
	
	function db($sql,$data = ""){
		$connectionString  = "mysql:dbname=coiffeur;";
		$connectionString .= "host=backupmg.homelinux.org;";
		$connectionUser = "coiffeur"; 
		$connectionPassword = "testcoiff";

		try{
			$c = new PDO($connectionString, $connectionUser, $connectionPassword);
		}catch( Exception $e ){
			echo "Une &eacute;rreur est survenue : ".$e->getMessage();
		}
		$requete = $c->prepare($sql);
		if($data != ""){
			if(!(is_array($data))){
				$data = array($data);
			}
			$requete->execute($data);
		}else{ 
			$requete->execute();
		}
		return $requete->fetchAll(PDO::FETCH_ASSOC);
	}
	
	function array_delete_one_value($array,$search) {
		 $temp = array();
		 $one = false;
		 foreach($array as $value) {
			 if($value!=$search || $one) array_push($temp,$value);
			 if($value == $search) $one = true ;
		 }
		 return $temp;
	 }
	
	
//foreach ($array as $item){
//foreach($array as $key => $item){
//	$kiki=db("Select * from clients");
//	print_r($kiki);
//	print "<br/>";
//	print "<br/>";
//	foreach($kiki as $client){
//		print_r($client);
//		print "<br/>";
//		print "<br/>";
//		foreach ($client as $key => $item){
//			print $key."=====>".$item."<br/>";
//		}
//	}
?>